<%--
  Created by IntelliJ IDEA.
  User: peipei
  Date: 2022/8/29
  Time: 15:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="common.jsp" %>
<html>
<head>
    <title>心理测试后台管理系统</title>
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo layui-hide-xs layui-bg-black">AAA测试后台管理系统</div>
        <!-- 头部区域（可配合layui 已有的水平导航） -->

        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                <a href="javascript:;">
                    <img src="${user.avatar}" class="layui-nav-img">
                    ${user.username}
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="${pageContext.request.contextPath}/logout.do">注销</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
                <a href="javascript:;">
                    <i class="layui-icon layui-icon-more-vertical"></i>
                </a>
            </li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-shrink="all" lay-filter="test">
                <c:forEach items="${menuListMap.firstMenuList}" var="menu">
                    <li class="layui-nav-item layui-nav-itemed">
                        <a class="" href="javascript:;"><i class="${menu.icon}"></i>&nbsp;<span>${menu.menuName}</span></a>
                        <c:forEach items="${menuListMap.secondMenuList}" var="subMenu">
                            <%--                            判断子菜单是否属于当前父菜单--%>
                            <c:if test="${subMenu.parentId eq menu.menuId}">
                                <dl class="layui-nav-child">
                                    <dd>
                                        <a href="${pageContext.request.contextPath}${subMenu.url}">${subMenu.menuName}</a>
                                    </dd>
                                </dl>
                            </c:if>
                        </c:forEach>

                    </li>
                </c:forEach>

            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->

        <iframe id="iframMain" width="100%" height="100%" src="hello.jsp"></iframe>

    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        Copyright © QY156一期项目
    </div>
</div>
<script>
    layui.use(['element', 'jquery'], function () {
        var element = layui.element;
        var $ = layui.jquery;
        $(function () {
            //页面加载之后执行的代码
            //点击a标签的时候，修改iframe的src属性
            $("dd>a").click(function (e) {
                //阻断超链接的跳转事件
                e.preventDefault();
                //取得超链接对象的href属性值赋给iframe的src属性
                $("#iframMain").attr("src", $(this).attr("href"));
            })
        })
    });
</script>
</body>
</html>
